<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<jsp:include page="head.htm" />
<jsp:useBean id="date" class="java.util.Date" />
<script>
	$(function() {
		var dates = $("#from, #to")
				.datepicker(
						{
							//defaultDate : "+1w",
							changeMonth : true,
							numberOfMonths : 3,
							onSelect : function(selectedDate) {
								var option = this.id == "from" ? "minDate"
										: "maxDate", instance = $(this).data(
										"datepicker"), date = $.datepicker
										.parseDate(
												instance.settings.dateFormat
														|| $.datepicker._defaults.dateFormat,
												selectedDate, instance.settings);
								dates.not(this).datepicker("option", option,
										date);
							}
						});
		$("#from").datepicker("option", "dateFormat", "dd.mm.yy");
		$("#to").datepicker("option", "dateFormat", "dd.mm.yy");
		$("#from").datepicker("setDate", '<fmt:formatDate value="${krankheit.krankheit_von}" type="date" pattern="dd.MM.yyyy" />');
		$("#to").datepicker("setDate", '<fmt:formatDate value="${krankheit.krankheit_bis}" type="date" pattern="dd.MM.yyyy" />');
	});
</script>
</head>
<body>
	<jsp:include page="loggedIn.jsp" />
	<jsp:include page="isAdmin.jsp" />
	<div id="head">
		<h1>Zeiterfassung</h1>
	</div>
	<jsp:include page="menu.jsp" />
	<div id="content">
		<h2>
			<c:out value="${title}" />
		</h2>
		<form method="post" action="SaveKrankheit.html" class="button" id="validForm">
			<table cellpadding="0" cellspacing="0" class="atag">
				<colgroup>
					<col class="attribute" />
					<col class="value" />
				</colgroup>
				<tr>
					<th>Mitarbeiter</th>
					<th><c:choose>
							<c:when test="${check=='true'}">
								<select name="m_id">
									<c:forEach items="${mitarbeiter}" var="mitarbeiter">
										<option value="${mitarbeiter.id}"
											<c:if test="${mitarbeiter.id == krankheit.mitarbeiter.id}"><c:out value='selected="selected"'/></c:if>>${mitarbeiter.mit_name},
											${mitarbeiter.mit_vorname}</option>
									</c:forEach>
								</select>
							</c:when>
							<c:otherwise>
								<input type="hidden" name="id"
									value='<c:out value="${krankheit.id}"/>' />
								<input type="hidden" name="m_id"
									value='<c:out value="${krankheit.mitarbeiter.id}"/>' />
								<c:out value="${krankheit.mitarbeiter.mit_name}," />
								<c:out value="${krankheit.mitarbeiter.mit_vorname}" />


							</c:otherwise>
						</c:choose></th>
				</tr>
				<tr>
					<td>Von</td>
					<td>
						<input type="hidden" name="id" value='<c:out value="${krankheit.id}"/>' /> 
						<input type="text" class="textbox required" id="from" name="krankheit_von"	value='<fmt:formatDate value="${krankheit.krankheit_von}" type="date" pattern="dd.MM.yyyy" />' size="50" />
					</td>
				</tr>
				<tr>
					<td>Bis</td>
					<td>
						<input type="text" class="textbox required" id="to" name="krankheit_bis" value='<fmt:formatDate value="${krankheit.krankheit_bis}" type="date" pattern="dd.MM.yyyy" />' size="50" />
					</td>
				</tr>
				<tr class="submit">
					<td colspan="2"><input type="submit" value="Daten absenden" />
					</td>
				</tr>
			</table>
		</form>
	</div>
</body>
</html>
